node test: Improve --generate
authorMatthias Clasen <mclasen@redhat.com>
Sat, 3 Apr 2021 00:35:39 +0000 (20:35 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 3 Apr 2021 00:35:39 +0000 (20:35 -0400)
This is a pet peeve of mine: When we call
g_test_init() before handling --generate,
the random seed spew pollutes the output.
Highly annoying. I've fixes many test binaries
over the years, but more keep popping up.

testsuite/gsk/node-parser.c

index e7cf97887e43cdde2712ceb6d55f5958bdb9a861..3c4f61b8174ca3c986a06da38bf60ca36fa5c6ed 100644 (file)
@@ -315,13 +315,13 @@ main (int argc, char **argv)
 {
   gboolean success;
 
-  gtk_test_init (&argc, &argv);
-
   if (argc < 2)
     {
       const char *basedir;
       GFile *dir;
 
+      gtk_test_init (&argc, &argv);
+
       basedir = g_test_get_dir (G_TEST_DIST);
       dir = g_file_new_for_path (basedir);
       success = test_files_in_directory (dir);
@@ -334,6 +334,8 @@ main (int argc, char **argv)
         {
           GFile *file = g_file_new_for_commandline_arg (argv[2]);
 
+          gtk_init ();
+
           success = parse_node_file (file, TRUE);
 
           g_object_unref (file);
@@ -345,6 +347,8 @@ main (int argc, char **argv)
     {
       guint i;
 
+      gtk_test_init (&argc, &argv);
+
       success = TRUE;
 
       for (i = 1; i < argc; i++)